package edu.whu.tao.util;

import java.io.Serializable;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

import com.xiaoleilu.hutool.util.SecureUtil;

/**
 * 
 * <P>基本Object</P>
 * @author 陶焕(13294175866)
 * @date 2016年4月17日 下午8:19:52
 */
public class BaseObject implements Serializable {

	/**
	 * TODO
	 */
	private static final long serialVersionUID = 1L;

	public BaseObject() {
	}

	public Serializable getId(){
		return SecureUtil.simpleUUID();
	}
	
	public boolean equals(Object other) {
		return EqualsBuilder.reflectionEquals(this, other);
	}

	public int hashCode() {
		return HashCodeBuilder.reflectionHashCode(this);
	}

	public String toString() {
		return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
	}

	public Object toJson() {
		return JsonBuilder.toJson(this);
	}

}
